package easy;

public class Solution_1413 {

    public int minStartValue(int[] nums) {
        int min = 101;
        int sum = 0;
        for (int num : nums) {
            sum += num;
            if (sum < min) {
                min = sum;
            }
        }
        return min > 0 ? 1 : (1 - min);
    }

    public static void main(String[] args) {
        Solution_1413 model = new Solution_1413();
        System.out.println(model.minStartValue(new int[]{-3, 2, -3, 4, 2}));
        System.out.println(model.minStartValue(new int[]{1, 2}));
        System.out.println(model.minStartValue(new int[]{1, -2, -3}));
    }
}
